package com.pe.cineplanet.proyectocine.repository.hibernate;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import com.pe.cineplanet.proyectocine.domain.Butaca;
import com.pe.cineplanet.proyectocine.repository.ButacaRepository;
 
@Repository
public class ButacaRepositoryHibernate extends HibernateDaoSupport 
implements ButacaRepository{
	
	//constructor
	@Autowired
	public ButacaRepositoryHibernate(SessionFactory sessionFactory) {
		setSessionFactory(sessionFactory);
	}
	
	public List<Butaca> obtenerButacas() {
		return getHibernateTemplate().find("from Butaca");   
	}

	/*public Butaca obtenerButaca(int id_Sala) {
		return (Butaca) getSession().createQuery("from Butaca u where u.id_Sala=?").setInteger(0,id_Sala).uniqueResult();
	}*/

	public void grabarButaca(Butaca obj) {
		getHibernateTemplate().saveOrUpdate(obj);
		
	}

	public void removerButaca(int id_Sala) {
		//Butaca obj = obtenerButaca(id_Sala);
		//getHibernateTemplate().delete(obj);
		
	}

}
